package org.xyl.context;

import java.util.*;

/**
 * 业务实体上下文 - 存储设备、客户、工单等核心业务对象信息
 */
public class BusinessEntityContext {
    private List<Device> devices;
    private List<Customer> customers;
    private List<WorkOrder> workOrders;
    private List<Alert> alerts;
    
    public BusinessEntityContext() {
        this.devices = new ArrayList<>();
        this.customers = new ArrayList<>();
        this.workOrders = new ArrayList<>();
        this.alerts = new ArrayList<>();
    }
    
    public void addDevice(Device device) {
        this.devices.add(device);
    }
    
    public void addCustomer(Customer customer) {
        this.customers.add(customer);
    }
    
    public void addWorkOrder(WorkOrder workOrder) {
        this.workOrders.add(workOrder);
    }
    
    public void addAlert(Alert alert) {
        this.alerts.add(alert);
    }
    
    public List<Device> getDevices() {
        return devices;
    }
    
    public List<Customer> getCustomers() {
        return customers;
    }
    
    public List<WorkOrder> getWorkOrders() {
        return workOrders;
    }
    
    public List<Alert> getAlerts() {
        return alerts;
    }
    
    /**
     * 设备类
     */
    public static class Device {
        private String deviceId;
        private String model;
        private String firmwareVersion;
        private String customerId;
        
        public Device(String deviceId, String model, String firmwareVersion, String customerId) {
            this.deviceId = deviceId;
            this.model = model;
            this.firmwareVersion = firmwareVersion;
            this.customerId = customerId;
        }
        
        public String getDeviceId() {
            return deviceId;
        }
        
        public String getModel() {
            return model;
        }
        
        public String getFirmwareVersion() {
            return firmwareVersion;
        }
        
        public String getCustomerId() {
            return customerId;
        }
    }
    
    /**
     * 客户类
     */
    public static class Customer {
        private String customerId;
        private String name;
        private String contactInfo;
        
        public Customer(String customerId, String name, String contactInfo) {
            this.customerId = customerId;
            this.name = name;
            this.contactInfo = contactInfo;
        }
        
        public String getCustomerId() {
            return customerId;
        }
        
        public String getName() {
            return name;
        }
        
        public String getContactInfo() {
            return contactInfo;
        }
    }
    
    /**
     * 工单类
     */
    public static class WorkOrder {
        private String workOrderId;
        private String deviceId;
        private String customerId;
        private String description;
        private String status;
        private Date createTime;
        
        public WorkOrder(String workOrderId, String deviceId, String customerId, 
                        String description, String status, Date createTime) {
            this.workOrderId = workOrderId;
            this.deviceId = deviceId;
            this.customerId = customerId;
            this.description = description;
            this.status = status;
            this.createTime = createTime;
        }
        
        public String getWorkOrderId() {
            return workOrderId;
        }
        
        public String getDeviceId() {
            return deviceId;
        }
        
        public String getCustomerId() {
            return customerId;
        }
        
        public String getDescription() {
            return description;
        }
        
        public String getStatus() {
            return status;
        }
        
        public Date getCreateTime() {
            return createTime;
        }
    }
    
    /**
     * 告警类
     */
    public static class Alert {
        private String alertId;
        private String deviceId;
        private String type;
        private String level;
        private String message;
        private Date triggerTime;
        
        public Alert(String alertId, String deviceId, String type, 
                    String level, String message, Date triggerTime) {
            this.alertId = alertId;
            this.deviceId = deviceId;
            this.type = type;
            this.level = level;
            this.message = message;
            this.triggerTime = triggerTime;
        }
        
        public String getAlertId() {
            return alertId;
        }
        
        public String getDeviceId() {
            return deviceId;
        }
        
        public String getType() {
            return type;
        }
        
        public String getLevel() {
            return level;
        }
        
        public String getMessage() {
            return message;
        }
        
        public Date getTriggerTime() {
            return triggerTime;
        }
    }
}